Imports System.Xml
Imports System.Data.SqlClient
Public Class dDetalleFacturaVenta
  Public Function Existe(ByVal idDetalleFactura as String) as BOOLEAN
     Dim Parametros As ArrayList = New ArrayList
     if idDetalleFactura <> "" then 
       Parametros.Add(New SqlParameter("@pEidDetalleFactura", idDetalleFactura))
     End If
        Return (dConexion.Consultar("STORE_TblDetalleFacturaVentaBUSCARFILTRADO", Parametros).Tables(0).Rows(0).ItemArray(0) = 1)
  End Function
    Public Function Insertar(ByVal Subtotal As String, ByVal Total As String, ByVal IVA As String, ByVal idFactura As String, ByVal CodigoConcepto As String, ByVal CodigoRemito As String) As Boolean
        Dim Parametros As ArrayList = New ArrayList
        If Subtotal <> "" Then
            Parametros.Add(New SqlParameter("@pESubtotal", CDbl(Subtotal)))
        End If
        If Total <> "" Then
            Parametros.Add(New SqlParameter("@pETotal", CDbl(Total)))
        End If
        If IVA <> "" Then
            Parametros.Add(New SqlParameter("@pEIVA", CDbl(IVA)))
        End If
        If idFactura <> "" Then
            Parametros.Add(New SqlParameter("@pEidFactura", idFactura))
        End If
        If CodigoConcepto <> "" Then
            Parametros.Add(New SqlParameter("@pECodigoConcepto", CodigoConcepto))
        End If
        If CodigoRemito <> "" Then
            Parametros.Add(New SqlParameter("@pECodigoRemito", CodigoRemito))
        End If
        Return dConexion.ABM("STORE_TblDetalleFacturaVentaALTA", Parametros)
    End Function
    Public Function Eliminar(ByVal idDetalleFactura As String, ByVal idFactura As String) As Boolean
        Dim Parametros As ArrayList = New ArrayList
        If idDetalleFactura <> "" Then
            Parametros.Add(New SqlParameter("@pEidDetalleFactura", idDetalleFactura))
        Else
            If idFactura <> "" Then
                Parametros.Add(New SqlParameter("@pEidFactura", idFactura))
            End If
        End If
        Return dConexion.ABM("STORE_TblDetalleFacturaVentaELIMINAR", Parametros)
    End Function
    Public Function BuscarFiltrado(ByVal idDetalleFactura As String, ByVal Subtotal As String, ByVal Total As String, ByVal IVA As String, ByVal idFactura As String, ByVal CodigoConcepto As String, ByVal CodigoRemito As String) As DataSet
        Dim Parametros As ArrayList = New ArrayList
        If idDetalleFactura <> "" Then
            Parametros.Add(New SqlParameter("@pEidDetalleFactura", idDetalleFactura))
        End If
        If Subtotal <> "" Then
            Parametros.Add(New SqlParameter("@pESubtotal", CDbl(Subtotal)))
        End If
        If Total <> "" Then
            Parametros.Add(New SqlParameter("@pETotal", CDbl(Total)))
        End If
        If IVA <> "" Then
            Parametros.Add(New SqlParameter("@pEIVA", CDbl(IVA)))
        End If
        If idFactura <> "" Then
            Parametros.Add(New SqlParameter("@pEidFactura", idFactura))
        End If
        If CodigoConcepto <> "" Then
            Parametros.Add(New SqlParameter("@pECodigoConcepto", CodigoConcepto))
        End If
        If CodigoRemito <> "" Then
            Parametros.Add(New SqlParameter("@pECodigoRemito", CodigoRemito))
        End If
        Return dConexion.Consultar("STORE_TblDetalleFacturaVentaBUSCARFILTRADO", Parametros)
    End Function
End Class
